#!/usr/etc/env python
#_*_ coding:utf-8 _*_
'''
    TODO
'''
from flask import Blueprint , render_template , flash, g,session
from flask import redirect , request ,  url_for , abort
from apps import app

post = Blueprint('post',__name__)

@app.route('/add',methods=['POST'])
def add_entry():
    if not session.get('logged_in'):
        abort(401)
    g.db.execute('insert into entries (title, text) values (?,?)',[request.form['title'],request.form['text']])
    g.db.commit()
    flash('New entry was successfully posted')
    return redirect(url_for('show_entries'))


